package com.witsight.platform;

import java.util.HashMap;
import java.util.Map;

import org.slf4j.Marker;
import org.slf4j.MarkerFactory;

/**   
 * 说明：框架Constants常量工具类类
 * @Title: Constants.java 
 * @Package com.witsight.platform 
 * @See: {@link #Constants()}<br/>
 * Copyright: Copyright (c) 2017<br/>
 * Company:sany huax witsight team by product
 * @author: penght  
 * @date: 2017年10月11日 下午5:06:26 
 * @version: V1.0
 *
 */
public abstract class Constants {
	// 开发环境
	public final static String PROFILE_DEV = "dev";
	// 管理员角色编码
	public final static String ROLE_ADMIN = "ROLE_ADMIN";
	
	/**
	 * 
	 * 说明：资源类型
	 * @Title: Constants.java 
	 * @Package com.witsight.auth 
	 * @See: {@link RES_TYPE}
	 * Copyright: Copyright (c) 2017
	 * Company:sany huax witsight team by product
	 * @author: penght   
	 * @date: 2017年10月27日 上午10:00:56 
	 * @version: V1.0
	 *
	 */
	public static enum RES_TYPE {
		MENU, URL, ELEMENT;
		private static final Map<String, RES_TYPE> mappings = new HashMap<String, RES_TYPE>(3);

		static {
			for (RES_TYPE resType : values()) {
				mappings.put(resType.name(), resType);
			}
		}


		/**
		 * Resolve the given resource value to an {@code HttpMethod}.
		 * @param method the method value as a String
		 * @return the corresponding {@code HttpMethod}, or {@code null} if not found
		 */
		public static RES_TYPE resolve(String type) {
			return (type != null ? mappings.get(type) : null);
		}


		/**
		 * Determine whether this {@code RES_TYPE} matches the given
		 * resource value.
		 * @param type the resource value as a String
		 * @return {@code true} if it matches, {@code false} otherwise
		 */
		public boolean matches(String type) {
			return (this == resolve(type));
		}
	}
	// 事物的顺序
	public static final int TX_ORDER = 2;
	// 日志顺序
	public static final int LOGGING_ORDER = TX_ORDER + 1;
	// 自动写入日志的标识
	public static final Marker AUTO_MARKER = MarkerFactory.getMarker("AUTO_WRITE");
	/**
	 * 说明：国际化语言配置
	 */
	public static final String BUNDLE_KEY = "i18n/messages";
	/**
	 * 说明：AD域认证方式
	 */
	public static final String AD_LOGINTYPE = "pwd";
	/**
	 * 说明：cookie头名称
	 */
	public static final String COOKIE = "Set-Cookie";
	
}
